import http.server, ssl

 
server_address = ('127.0.0.1', 4443)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
                               server_side=True,
                               certfile='..\cert.pem',
                               keyfile="..\key.key",
                               ssl_version=ssl.PROTOCOL_TLSv1_2)
httpd.serve_forever()
